//
//  ViewController.m
//  百度地图001
//
//  Created by song on 15/8/15.
//  Copyright (c) 2015年 song. All rights reserved.
//

#import "ViewController.h"
#import <BaiduMapAPI/BMapKit.h>//引入所有的头文件

@interface ViewController () <BMKMapViewDelegate>
{
    IBOutlet BMKMapView* _mapView;
}

@end

@implementation ViewController


-(void)viewDidAppear:(BOOL)animated
{
    BMKPointAnnotation *annotation = [[BMKPointAnnotation alloc] init];
    
    CLLocationCoordinate2D coor;
    coor.latitude  = 39.915;
    coor.longitude = 116.404;
    
    annotation.coordinate = coor;
    annotation.title =@"这就是 北京";
    [_mapView addAnnotation:annotation];
}

-(BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id<BMKAnnotation>)annotation
{
    if([annotation isKindOfClass:[BMKAnnotationView class]])
    {
        BMKPinAnnotationView *newAnnotationView =[[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myannotation"];
        newAnnotationView.pinColor =BMKPinAnnotationColorRed;
        newAnnotationView.animatesDrop =YES; //设置该点动画显示
        return newAnnotationView;
    }
    return nil;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    _mapView= [[BMKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
//    [mapview setMapType:BMKMapTypeSatellite];  //打开百度地图的卫星功能
    [_mapView setMapType:BMKMapTypeStandard];    //打开地图的标准模式
    [_mapView setTrafficEnabled:YES];        //地图的交通情况
    [_mapView setBaiduHeatMapEnabled:YES];  //地图的热力情况
    
    self.view = _mapView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
